﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Test_API
{
    public class LogEntry
    {
        public long elapsedTime;
        public string module;
        public string methodName;
        public string inputs;
        public readonly bool expectedResult;
        public string receivedData;
        public bool verdict;

        public LogEntry(string moduleName, bool expectedResult)
        {
            this.module = moduleName;
            this.expectedResult = expectedResult;

            this.elapsedTime = -1;
            this.methodName = this.inputs = this.receivedData = null;
            this.verdict = false;
        }

        public override string ToString()
        {
            List<string> elements = new List<string>();

            elements.Add(elapsedTime.ToString());
            elements.Add(module);
            elements.Add(methodName);
            elements.Add(inputs);
            elements.Add(expectedResult.ToString());
            elements.Add(receivedData);
            elements.Add(verdict.ToString());

            if (verdict == false)
            {
                Console.WriteLine("Method: {0}.\nResult: {1}\nverdict: {2}\n", methodName, receivedData, verdict);
            }
            return String.Join(",", elements
            .Select(x => x.StringToCSVCell())
            .ToArray());
        }
    }
}
